<?php
/**
 * Created by PhpStorm.
 * User: zhao
 * Date: 2018/5/23
 * Time: 18:11
 */

namespace App\Handlers;


class BaseHandle
{
    /**
     * @param array $message
     * @param $name
     * @throws \Exception
     */
    public function _log(array $message,$name)
    {
        $log = new \Monolog\Logger($name);
        $logDir = storage_path('logs');
        if (!is_dir($logDir)) mkdir($logDir, 0777, true);

        $log->pushHandler(new \Monolog\Handler\StreamHandler($logDir . '/' . $name. '.log', \Monolog\Logger::ERROR));

        $log->error('error',$message);
    }
}